package Practice.Practice_02.LoginAndRegistration;

import java.util.Objects;
import java.util.Scanner;

public class Login {
    public Login(){

    }
    public static void login(Account[] acc){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名");
        String username = sc.next();
        System.out.println("请输入密码");
        String password = sc.next();
        for(int i = 0; i < acc.length; i++){
            if(Objects.equals(acc[i].getUsername(),username) && Objects.equals(acc[i].getPassword(),password)){
                System.out.println("登录成功！");
                System.exit(0);
            }else{
                System.out.println("登录失败！");
            }
        }
    }
}
